@echo off
setlocal enabledelayedexpansion
chcp 65001

set "perf=--jobs=%NUMBER_OF_PROCESSORS% --python-flag=-O,no_docstrings --show-scons --show-progress"
set "nuitka=cmd /c .venv\Scripts\python -m nuitka %perf% --windows-icon-from-ico=logo.ico --remove-output"
set "filename=BiRefNet抠图.py"

for %%f in (*.exe *.pyi *.pyd) do IF EXIST %%f del %%f
%nuitka% main.py --module --nofollow-imports
echo import os;os.system('.venv\Scripts\python -c "import main"') > %filename%
%nuitka% %filename% --onefile

for %%f in (*.pyi %filename%) do IF EXIST %%f del %%f
